package com.example.dao;

import com.example.entity.Banteacher;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BanteacherDao {


    /**
     * 分页查询
     * @param currentPage  当前页
     * @param pageSize     当前页条数
     * @return
     */
    @Select("select * from banteacher limit #{currentPage}, #{pageSize}")
    public List<Banteacher> getPage(@Param("currentPage") int currentPage, @Param("pageSize")int pageSize);

    /**
     * 查询总记录数
     * @return
     */
    @Select("select count(*) from banteacher")
    public int getTotalCount();


    @Insert("insert into banteacher(ban_number,ban_name,subject,job_number,name,major,position) " +
                          "values(#{banNumber},#{banName},#{subject},#{jobNumber},#{name},#{major},#{position})")
    public int add(Banteacher banteacher);

    @Delete("delete from banteacher where id=#{id}")
    public Boolean deleteById(@Param("id") Integer id);

    @Update("update banteacher set ban_number=#{banNumber},ban_name=#{banName},ban_name=#{banName},job_number=#{jobNumber}," +
            "name=#{name},major=#{major},position=#{position} where id=#{id}")
    public int update(Banteacher banteacher) ;
}
